home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / tools / Bridge Part.lua < prev    next >
Text File  |  2009-09-13  |  1KB  |  39 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Bridge Part
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, August 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.bridgepart={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.bridgepart.gfx_wpn=loadgfx("buildings/bridgepart.bmp")                            -- Weapon Image
  13. setmidhandle(cc.bridgepart.gfx_wpn)
  14. cc.bridgepart.sfx_build=loadsfx("buildwood.ogg")                                    -- Build Sound
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Bridge Part
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.bridgepart.id=addweapon("cc.bridgepart","Bridge Part",cc.bridgepart.gfx_wpn,5)    -- Add Weapon (5 uses)
  21.  
  22. function cc.bridgepart.draw()                                                        -- Draw
  23.     -- HUD Positioning
  24.     if weapon_shots==0 then
  25.         hudpositioning(pos_build,cc.bridgepart.gfx_wpn)
  26.     end
  27. end
  28.  
  29. function cc.bridgepart.attack(attack)                                                -- Attack
  30.     if (weapon_shots<=0) and (weapon_position==1) then
  31.         -- Use weapon and allow to use another one afterwards (1)
  32.         useweapon(1)
  33.         weapon_shots=weapon_shots+1
  34.         -- Draw
  35.         terrainimage(cc.bridgepart.gfx_wpn,weapon_x,weapon_y)
  36.         -- Sound
  37.         playsound(cc.bridgepart.sfx_build)
  38.     end
  39. end